<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <head>
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.0.0/animate.min.css" />
    </head>
</head>
<style>
    .v-enter {
        opacity: 0;
        transform: translateX(-400px);
    }

    .v-enter-active {
        transition: all 3s ease;
        background-color: orangered;
    }

    .v-enter-to {
        opacity: 1;
        transform: translate(0);
    }

    .v-leave {
        opacity: 1;
        transform: translate(0);
    }

    .v-leave-active {
        transition: all 3s ease;
        background-color: rgb(89, 0, 255);
    }

    .v-leave-to {
        opacity: 0;
        transform: translateX(-400px);
    }
</style>

<body>
    <div id='app'>
        <button @click='flag = !flag'>切换动画</button>
        <transition>
            <div appear v-show='!flag' style="font-size: 40px; text-align: center;">哈哈哈哈哈哈哈</div>
        </transition>
    </div>

    <script>
        const vm = new Vue({
            el: '#app',
            data: {
                flag: true
            }
        })
    </script>
</body>

</html>